package com.example.store2.Mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Objects;

@Mapper
public interface AttenMapper {
   // 根据用户ID和被关注用户ID查询关注数
    @Select("{CALL selectnum(#{userId, mode=IN, jdbcType=INTEGER}, #{beuserId, mode=IN, jdbcType=INTEGER})}")
    @Options(statementType = StatementType.CALLABLE)
    Integer find(Integer userId, Integer beuserId);

    // 添加关注
    @Insert("insert into attention(user_id,beuser_id) values (#{userId},#{beuserId})")
    void add(Integer userId, Integer beuserId);
}
